Skip to content

Add support for versions 3.15 and 3.16, drop support for versions 3.8 and below#68

Merged
rvlb merged 3 commits intodevelopfrom
drf-315-316
Sep 2, 2025
Merged

Add support for versions 3.15 and 3.16, drop support for versions 3.8 and below#68
rvlb merged 3 commits intodevelopfrom
drf-315-316

Conversation

@rvlb
Copy link
Copy Markdown
Contributor

@rvlb rvlb commented Sep 2, 2025

Summary by Sourcery

Update supported Django REST Framework versions and refresh tooling configuration.

New Features:

  • Add support for DRF versions 3.15 and 3.16

Enhancements:

  • Remove support for DRF versions 3.1–3.8 from tox and config
  • Upgrade Fabric, python-decouple, and tox to latest versions
  • Update REST_FRAMEWORK_VERSIONS list to include 3.15 and 3.16 and to remove versions 3.8 and below

CI:

  • Switch GitHub Actions workflows to use Python 3.10 instead of 3.8

Tests:

  • Adjust test_renderers expectations to align with updated version mappings

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Sep 2, 2025

Reviewer's Guide

This PR overhauls version support by removing DRF 3.1–3.8 and adding DRF 3.15–3.16 across project configuration, CI workflows, dependencies, and tests.

File-Level Changes

Change Details Files
Overhaul Tox configuration to drop old DRF versions and add support for newer ones
  • Removed DRF 3.1–3.8 envlist entries and dependency blocks
  • Added deps315 and deps316 definitions with Django 5.2.5 and DRF 3.15–3.16
  • Consolidated testenv and drfbuild sections to reflect the new versions
build.ini
Update supported REST framework versions list
  • Removed versions 3.1–3.8 from REST_FRAMEWORK_VERSIONS
  • Added versions 3.15 and 3.16
rest_framework_ccbv/config.py
Bump project dependencies
  • Updated Fabric to 3.2.2
  • Updated python-decouple to 3.8
  • Updated tox to 4.29.0
requirements.txt
Adjust GitHub Actions Python setup versions
  • Changed Python version from 3.8 to 3.13 in build workflow
  • Changed Python version from 3.8 to 3.13 in release workflow
.github/workflows/build.yml
.github/workflows/release.yml
Revise version-dependent test expectations
  • Updated KLASS_FILE_CONTENT mapping key from '3.2' to '3.9'
  • Adjusted expected other_versions in test to ['3.9']
tests/test_renderers.py

Possibly linked issues

  • #0: The PR updates Classy DRF to support Django REST Framework versions 3.15 and 3.16, as requested, and also removes older version support.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Consider refactoring the tox env definitions to use factor notation or dynamic generation to avoid manual repetition for each DRF version.
  • It might be worthwhile to expand your GitHub Actions matrix to run tests across multiple Python versions, not just 3.13, to catch compatibility issues earlier.
  • Centralizing the supported DRF versions (e.g. reading from a single source or generating config entries) could reduce the risk of version list drift in config.py and build.ini.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider refactoring the tox env definitions to use factor notation or dynamic generation to avoid manual repetition for each DRF version.
- It might be worthwhile to expand your GitHub Actions matrix to run tests across multiple Python versions, not just 3.13, to catch compatibility issues earlier.
- Centralizing the supported DRF versions (e.g. reading from a single source or generating config entries) could reduce the risk of version list drift in config.py and build.ini.

## Individual Comments

### Comment 1
<location> `tests/test_renderers.py:16` </location>
<code_context>

 KLASS_FILE_CONTENT = (
-    '{"3.2": {"rest_framework.generics": ["RetrieveDestroyAPIView", "ListAPIView"]},'
+    '{"3.9": {"rest_framework.generics": ["RetrieveDestroyAPIView", "ListAPIView"]},'
     '"%s": {"rest_framework.generics": ["RetrieveDestroyAPIView", "ListAPIView"]}}' % VERSION
 )
</code_context>

<issue_to_address>
Test data updated to reference version 3.9, but no tests for new versions 3.15 and 3.16.

Please add or update tests to cover versions 3.15 and 3.16 to ensure proper support and early detection of any issues.

Suggested implementation:

```python
        assert context['other_versions'] == ['3.9', '3.15', '3.16']

```

```python
        assert context['name'] == ListAPIView.__name__
        assert isinstance(context['ancestors'], (list, tuple))
        assert isinstance(context['direct_ancestors'], (list, tuple))

    def test_context_versions_315_316(self, get_template_mock):
        self.renderer.render('foo')
        context = get_template_mock.return_value.render.call_args_list[0][0][0]
        # Ensure 3.15 and 3.16 are present in other_versions
        assert '3.15' in context['other_versions']
        assert '3.16' in context['other_versions']

```
</issue_to_address>

### Comment 2
<location> `tests/test_renderers.py:101` </location>
<code_context>
         self.renderer.render('foo')
         context = get_template_mock.return_value.render.call_args_list[0][0][0]
-        assert context['other_versions'] == ['3.2']
+        assert context['other_versions'] == ['3.9']
         assert context['name'] == ListAPIView.__name__
         assert isinstance(context['ancestors'], (list, tuple))
</code_context>

<issue_to_address>
Assertion only checks for '3.9' in other_versions, missing coverage for all supported versions.

Parametrize the test or add assertions to verify that 'other_versions' contains all supported versions, not just '3.9'.

Suggested implementation:

```python
        expected_versions = ['3.9', VERSION]
        # Remove the current version from other_versions if present, as it's usually excluded
        expected_other_versions = [v for v in expected_versions if v != VERSION]
        assert sorted(context['other_versions']) == sorted(expected_other_versions)

```

If there are more supported versions, update `expected_versions` accordingly. If you want to parametrize the test for each version, consider using pytest's `@pytest.mark.parametrize` decorator and refactor the test to accept a version argument.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tests/test_renderers.py
Comment thread tests/test_renderers.py
@rvlb rvlb merged commit eac7e40 into develop Sep 2, 2025
1 check passed
@fjsj fjsj deleted the drf-315-316 branch September 30, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants